package com.lin.sqltool.dialog;

import com.lin.sqltool.controller.ConnectionDialogController;
import com.lin.sqltool.listener.SimpleConnectionListener;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;
import java.util.Optional;

public class ConnectionDialog extends Stage{

    public ConnectionDialog(SimpleConnectionListener listener) {
        super();
        setMinHeight(360);
        this.setTitle("编辑数据库连接");

        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ConnectionDialog.fxml"));
            Scene scene = new Scene(loader.load(), 400, 250);
            ConnectionDialogController controller = loader.getController();
            controller.setListener(listener);
            this.setScene(scene);
        } catch (IOException e) {
            e.printStackTrace();
        }

        show();
    }


}
